from google.appengine.ext import db

class Post(db.Model):
  """Abstraction for a post in blog.
  """
  title = db.StringProperty()
  poster = db.StringProperty()
  created = db.DateTimeProperty()
  modified = db.DateTimeProperty()
  content = db.TextProperty()  

class Music(db.Model):
  """this entity represent the music object.
  """
  title = db.StringProperty()
  uploader = db.StringProperty()
  description = db.TextProperty()
  created = db.DateTimeProperty()
  data = db.BlobProperty()
   
class Picture(db.Model):
  """this entity represent the picture object.
  """
  title = db.StringProperty()
  uploader = db.StringProperty()
  description = db.StringProperty()
  created = db.DateTimeProperty()
#  parent = db.SelfReference(collection_name="next")
  content = db.BlobProperty()
  

class Comment(db.Model):
  """Abstraction for a comment in blog
  """
  parent_post = db.ReferenceProperty(Post, collection_name='comments')
  parent_music = db.ReferenceProperty(Music, collection_name='comments')
  parent_picture = db.ReferenceProperty(Picture, collection_name='comments')
  title = db.StringProperty()
  poster = db.StringProperty()
  created = db.DateTimeProperty()
  content = db.TextProperty()
  
